package com.qiche.service.impl;

import com.qiche.model.SubscribeConfig;
import com.qiche.service.SubscribeConfigService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * Created by Linzw on 2018/01/24.
 */
@Service("subscribeConfigService")
public class SubscribeConfigServiceImpl extends BaseService<SubscribeConfig> implements SubscribeConfigService {

    @Override
    public SubscribeConfig selectByMerchantId(Integer merchantId) {
        Example example=new Example(SubscribeConfig.class);
        Example.Criteria criteria=example.createCriteria();
        criteria.andEqualTo("merchantId",merchantId);
        List<SubscribeConfig> offerList=mapper.selectByExample(example);
        if(!offerList.isEmpty()){
            return  offerList.get(0);
        }
        return null;
    }
}
